<template>
    <el-menu
       default-active="1"
       class="el-menu-vertical-demo"  
       background-color="#334157"
       text-color="#fff"
       active-text-color="#ffd04b">
       
       <el-submenu :index="item.id +''" v-for="(item, index) in menulist" :key="index">
         <template slot="title">
           <i :class="item.icon"></i>
           <span>{{item.name}}</span>
         </template>
         <el-menu-item-group>          
           <el-menu-item :index="subMenu.id +''" @click="handlerMenu(subMenu.href)" v-for="(subMenu, index) in item.children" :key="index">{{subMenu.name}}</el-menu-item>         
         </el-menu-item-group>        
       </el-submenu>
       
     </el-menu>
 </template>
 
 <script>
 export default {
   data() {
     return {
          menulist: [],
     };
   },
   methods: {
     handlerMenu(url){
         this.$router.push(url);
     }
   },
   mounted(){
     this.menulist = JSON.parse(sessionStorage.getItem("menuList"));
   }
 };
 </script>